Move ImageHandler.create call to initDomain, after the call to xc.domain_create.
authoremellor@ewan <emellor@ewan>
Fri, 23 Sep 2005 15:50:02 +0000 (16:50 +0100)
committeremellor@ewan <emellor@ewan>
Fri, 23 Sep 2005 15:50:02 +0000 (16:50 +0100)
This ensures that ImageHandler has the correct domain ID available to it, which
seems sensible in general, and is necessary for the VMX VNC support in
particular.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/XendDomainInfo.py

index 8180eda9ac6f14ef59213ff16cc9212637bfdd20..384a8275c3e6cb31c0e5c2ac0c77e2cefdf8e72c 100644 (file)
@@ -614,7 +614,7 @@ class XendDomainInfo:
             sxpr.append(['maxmem', self.info['maxmem_KiB'] / 1024])
 
             if self.infoIsSet('device'):
-                for (n, c) in self.info['device']:
+                for (_, c) in self.info['device']:
                     sxpr.append(['device', c])
 
             def stateChar(name):
@@ -706,13 +706,6 @@ class XendDomainInfo:
         """
         # todo - add support for scheduling params?
         try:
-            if 'image' not in self.info:
-                raise VmError('Missing image in configuration')
-
-            self.image = ImageHandler.create(self,
-                                             self.info['image'],
-                                             self.info['device'])
-
             self.initDomain()
 
             # Create domain devices.
@@ -737,6 +730,14 @@ class XendDomainInfo:
 
         self.domid = xc.domain_create(dom = self.domid or 0,
                                       ssidref = self.info['ssidref'])
+
+        if 'image' not in self.info:
+            raise VmError('Missing image in configuration')
+
+        self.image = ImageHandler.create(self,
+                                         self.info['image'],
+                                         self.info['device'])
+
         if self.domid <= 0:
             raise VmError('Creating domain failed: name=%s' %
                           self.info['name'])